package com.iflytek.universitymanagement.controller;

import com.iflytek.universitymanagement.domain.Reply;
import com.iflytek.universitymanagement.service.ReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/replies")
public class ReplyController {
    @Autowired
    private ReplyService replyService;

    @GetMapping("/comment/{commentId}")
    public List<Reply> getReplies(@PathVariable Integer commentId) {
        return replyService.getRepliesByCommentId(commentId);
    }

    @PostMapping
    public void postReply(@RequestBody Reply reply) {
        replyService.addReply(reply);
    }
}